import { debounce } from "./utils";
import BackTop from "components/content/backtop/BackTop";
export const itemListenerMixin = {
  data() {
    return {
      itemImgListener: null,
      newRefresh:null
    }
  },
  mounted() {
    this.newRefresh = debounce(this.$refs.scroll.refresh, 100)
    this.itemImgListener = () => {
      this.newRefresh()
    }
    this.$bus.$on('itemImageLoad', this.itemImgListener)
  },
}

export const backTopMixin = {
  data(){
    return {
      isShow: null,
    }
  },
  methods: {
    backClick() {
      this.$refs.scroll.scrollTo(0, 0, 500);
    },
    listenBackTop(position){
      this.isShow = -position.y > 1000;
    }
  },
  components:{
    BackTop
  },
}